import unittest
from calculator import Count


class testDemo01(unittest.TestCase):
    def setUp(self):
        print('Start')

    def tearDown(self):
        print('End')

    def test01(self):
        print('This is demo01-test01.')

    def test02(self):
        print('This is demo01-test02.')

    def test03(self):
        print('This is demo01-test03.')


class testDemo02(unittest.TestCase):
    def test04(self):
        print('This is demo02-test04.')

    def test05(self):
        print('This is demo02-test05.')


if __name__ == '__name__':
    suite = unittest.TestSuite()
    # 加载该类
    # testCase01 = unittestdemo.TestLoader.loadTestsFromTestCase(testDemo01)
    # #加载导入的模块
    testCase02 = unittest.TestLoader.loadTestsFromModule(Count)
    # #加载testDemo02类中的测试方法test04
    testCase03 = unittest.TestLoader.loadTestsFromName('demo_unittest.unittestOthers.loaderTest.testDemo02.test04')
    suite.addTest(testCase03)
    r = unittest.TestResult()
    suite.run(result=r)
    print(r.__dict__)
